package com.example.test.model;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DataBaseHelper extends SQLiteOpenHelper {

	

	public static  SQLiteDatabase  getWriDatabase(Context context)
	{
		DataBaseHelper helper = new DataBaseHelper(context, "data", null, 2);
		return helper.getWritableDatabase();
	}
	
	public static  SQLiteDatabase  getRedDatabase(Context context)
	{
		DataBaseHelper helper = new DataBaseHelper(context, "data", null, 2);
		return helper.getReadableDatabase();
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table account ( name char(18) primary key,passwd char(20) not null,mail char(40) not null,sina_token char(60),sina_uid char(30),qq_token char(60),qq_uid char(50),renn_token char(60),net_token char(60),net_uid char(30),sohu_token char(60) )  ");
		
	}

	public DataBaseHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}

}
